package com.myidis.mapper;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.annotations.*;

import com.myidis.entity.QuotaDataItem;

public interface QuotaDataItemMapper {
	@Select("SELECT * FROM quota_dataitem")
    @Results({
    	@Result(property = "id", column = "id"),
    	@Result(property = "name", column = "name"),
        @Result(property = "description", column = "description")
    })
    ArrayList<QuotaDataItem> all();
	
    @Select("SELECT * FROM quota_dataitem WHERE id = #{id}")
    @Results({
    	@Result(property = "id", column = "id"),
    	@Result(property = "name", column = "name"),
        @Result(property = "description", column = "description")
    })
    QuotaDataItem getOne(int id);
	
	@Insert("INSERT INTO quota_dataitem(name, description) VALUES(#{name}, #{description})")
    int insert(QuotaDataItem quotaDataitem);

    @Insert("INSERT INTO quota_dataitem(name, description) VALUES(#{name}, #{description})")
    int sinsert(@Param("name") String name, @Param("description")String description);

    @Update("UPDATE quota_dataitem SET id = #{id}, name = #{name}, description = #{description} WHERE id = #{id}")
    int update(QuotaDataItem quotaDataitem);

    @Delete("DELETE FROM quota_dataitem WHERE id = #{id}")
    int delete(int id);

}
